<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body>
	假设一个Servlet在web.xml中是这么配置的，
	</br>
	<servlet-mapping> 
	<servlet-name>pathServlet</servlet-name>
	<url-pattern>/s/path/*</url-pattern> 
	</servlet-mapping>
	</br>
	<b>
		</br>访问的url是http://localhost:8080/project/servlet/path/xxx?param=xx，有以下几个跟访问路径相关的方法
		</br>uri=http://localhost:8080/project/servlet/path/xxx
		</br>host =localhost ;port=8080
		</br>ContextPath= "/project"
		</br>ServletPath= "/servlet/path/xxx"		
		</br>querystring = ?param=xx&user=zdy
		</b>
		
	</br></br> A.getContextPath()--->返回请求URI上下文部分--->/project
	</br>>>><%=request.getContextPath()%>
	</br></br> request.getServletPath()--->返回请求URI中调用Servlet的部分--->/servlet/path
	</br>>>><%=request.getServletPath()%>
	</br></br> request.getRequestURL()--->获取请求完整URL但不包括查询字符串--->http://localhost:8080/project/servlet/path/xxx
	</br>>>><%=request.getRequestURL()%>
	</br></br> request.getRequestURI()--->获取请求URI部分--->/project/servlet/path/xxx
	</br>>>><%=request.getRequestURI()%>
	</br></br> request.getQueryString()--->获取请求行中参数和值--->param=xx
	</br>>>><%=request.getQueryString()%>

	</br>
	</br>
	</br></br> request.getPathInfo()--->返回Servlet路径之后查询字符串之前的路径--->/xxx
	</br>>>>
	<%=request.getPathInfo()%>


	</br></br>application.getRealPath(request.getRequestURI());
	</br>>>>
	<%=application.getRealPath(request.getRequestURI())%>
	</br></br>application.getRealPath("/");
	</br>>>>
	<%=application.getRealPath("/WEB-INF/upload")%>
	</br></br>"根目录所对应的绝对路径"+request.getServletPath()
	</br>>>><%=request.getServletPath()%>
	</br></br>request.getServletContext().getRealPath("/")
	</br>>>>
	<%=request.getServletContext().getRealPath("/")%>
</body>
</html>